﻿using System.Collections.Generic;
using System.Threading.Tasks;
using MenusHunter.WinRT.Core.Services.Restaurant;
using System.Collections.ObjectModel;
namespace MenusHunter.WinRT.Core.Models
{
    public class RestaurantsManager
    {
        public static async Task<ObservableCollection<Restaurant>> GetListRestaurantAsync()
        {
            var client = new RestaurantsManager1SoapClient();

            var response = await client.GetListRestaurantAsync();

             return  response.Body.GetListRestaurantResult;
        }

        public static async Task<ObservableCollection<Restaurant>> GetListRestaurantAroundAsync(double currenLat,double currentLong,double radius,int offset,int limit)
        {
            var client = new RestaurantsManager1SoapClient();

            var response = await client.GetListRestaurantsAroundAsync(currenLat,currentLong,radius,offset,limit);

            return response.Body.GetListRestaurantsAroundResult;
        }

        public static async Task<int> NewRestaurantAsync(Restaurant restaurant)
        {
            var client = new RestaurantsManager1SoapClient();

            var response =
                await
                client.NewRestaurantAsync(restaurant.AccountId, restaurant.Name, restaurant.Description,
                                          restaurant.Photo, restaurant.Latitude, restaurant.Longtitude,
                                          restaurant.Address, restaurant.Phone, restaurant.IsFeature, restaurant.Status);

            return response.Body.NewRestaurantResult;
        }
    }
}
